
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      
      
      <link rel="icon" href="../../../assets/images/favicon.png">
      <meta name="generator" content="mkdocs-1.4.3, mkdocs-material-9.1.19">
    
    
      
        <title>Scripting Excel Spreadsheets using Epsilon - Epsilon</title>
      
    
    
      <link rel="stylesheet" href="../../../assets/stylesheets/main.eebd395e.min.css">
      
        
        <link rel="stylesheet" href="../../../assets/stylesheets/palette.ecc896b0.min.css">
      
      

    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
      <link rel="stylesheet" href="../../../assets/stylesheets/mermaid.css">
    
      <link rel="stylesheet" href="../../../assets/javascript/google-code-prettify/prettify.css">
    
      <link rel="stylesheet" href="https://unpkg.com/mermaid@8.5.1/dist/mermaid.css">
    
      <link rel="stylesheet" href="../../../assets/stylesheets/slick.css">
    
      <link rel="stylesheet" href="../../../assets/stylesheets/slick-theme.css">
    
      <link rel="stylesheet" href="../../../assets/stylesheets/extra.css">
    
    <script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      
<script>
  window.ga = window.ga || function() {
    (ga.q = ga.q || []).push(arguments)
  }
  ga.l = +new Date
  /* Setup integration and send page view */
  ga("create", "UA-184785655-1", "auto")
  ga("set", "anonymizeIp", true)
  ga("send", "pageview")
  /* Register handler to log search on blur */
  document.addEventListener("DOMContentLoaded", () => {
    if (document.forms.search) {
      var query = document.forms.search.query
      query.addEventListener("blur", function() {
        if (this.value) {
          var path = document.location.pathname;
          ga("send", "pageview", path + "?q=" + this.value)
        }
      })
    }
  })
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
    
    
    
  </head>
  
  
    
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="black" data-md-color-accent="orange">
  
    
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#scripting-excel-spreadsheets-using-epsilon" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

  

<header class="md-header md-header--shadow" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../../.." title="Epsilon" class="md-header__button md-logo" aria-label="Epsilon" data-md-component="logo">
      
  <img src="../../../assets/images/epsilon-white-background.png" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            Epsilon
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              Scripting Excel Spreadsheets using Epsilon
            
          </span>
        </div>
      </div>
    </div>
    
      
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list" role="presentation"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://github.com/eclipse/epsilon" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Epsilon @ GitHub
  </div>
</a>
      </div>
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../../.." title="Epsilon" class="md-nav__button md-logo" aria-label="Epsilon" data-md-component="logo">
      
  <img src="../../../assets/images/epsilon-white-background.png" alt="logo">

    </a>
    Epsilon
  </label>
  
    <div class="md-nav__source">
      <a href="https://github.com/eclipse/epsilon" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Epsilon @ GitHub
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../.." class="md-nav__link">
        Home
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../../getting-started/" class="md-nav__link">
        Getting Started
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../../playground" class="md-nav__link">
        Playground
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../../download/" class="md-nav__link">
        Download
      </a>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
      
      
      
        <label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
          Documentation
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5">
          <span class="md-nav__icon md-icon"></span>
          Documentation
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../" class="md-nav__link">
        Overview
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../emc/" class="md-nav__link">
        Model Connectivity
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" >
      
      
      
        <label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="0">
          Languages
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5_3">
          <span class="md-nav__icon md-icon"></span>
          Languages
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../eol/" class="md-nav__link">
        Object Language (EOL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../egl/" class="md-nav__link">
        Code Generation (EGL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../egx/" class="md-nav__link">
        Code Generation (EGX)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../evl/" class="md-nav__link">
        Model Validation (EVL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../etl/" class="md-nav__link">
        Model Transformation (ETL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../ecl/" class="md-nav__link">
        Model Comparison (ECL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../eml/" class="md-nav__link">
        Model Merging (EML)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../epl/" class="md-nav__link">
        Pattern Matching (EPL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../flock/" class="md-nav__link">
        Model Migration (Flock)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../emg/" class="md-nav__link">
        Model Generation (EMG)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../eunit/" class="md-nav__link">
        Unit Testing (EUnit)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../pinset/" class="md-nav__link">
        Dataset Extraction (Pinset)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../ewl/" class="md-nav__link">
        Wizard Language (EWL)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
      
      
      
        <label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="0">
          Tools
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5_4">
          <span class="md-nav__icon md-icon"></span>
          Tools
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../picto/" class="md-nav__link">
        Picto
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../flexmi/" class="md-nav__link">
        Flexmi
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../eugenia/" class="md-nav__link">
        Eugenia
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../exeed/" class="md-nav__link">
        Exeed
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../modelink/" class="md-nav__link">
        Modelink
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../hutn/" class="md-nav__link">
        HUTN
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../workflow/" class="md-nav__link">
        Workflow (Ant tasks)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../" class="md-nav__link">
        Articles
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../examples/" class="md-nav__link">
        Examples
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.youtube.com/epsilondevs" class="md-nav__link">
        Screencasts
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.youtube.com/playlist?list=PLRwHao6Ue0YUecg7vEUQTrtySIWwrd_mI" class="md-nav__link">
        Lectures
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_9" >
      
      
      
        <label class="md-nav__link" for="__nav_5_9" id="__nav_5_9_label" tabindex="0">
          Javadoc
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_9_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5_9">
          <span class="md-nav__icon md-icon"></span>
          Javadoc
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://download.eclipse.org/epsilon/stable-javadoc/" class="md-nav__link">
        Stable
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://download.eclipse.org/epsilon/interim-javadoc/" class="md-nav__link">
        Interim
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
      
      
      
        <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
          Issues
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_6">
          <span class="md-nav__icon md-icon"></span>
          Issues
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://github.com/eclipse/epsilon/issues/new/choose" class="md-nav__link">
        Report a new issue
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://github.com/eclipse/epsilon/issues" class="md-nav__link">
        View open issues
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://bugs.eclipse.org/bugs/buglist.cgi?product=epsilon&cmdtype=doit&order=Reuse+same+sort+as+last+time" class="md-nav__link">
        Bugzilla (legacy)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
      
      
      
        <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
          Community
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7">
          <span class="md-nav__icon md-icon"></span>
          Community
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_1" >
      
      
      
        <label class="md-nav__link" for="__nav_7_1" id="__nav_7_1_label" tabindex="0">
          Who is using Epsilon?
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_1_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7_1">
          <span class="md-nav__icon md-icon"></span>
          Who is using Epsilon?
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../users/" class="md-nav__link">
        Industry
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../users/education/" class="md-nav__link">
        Education
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../users/open-source/" class="md-nav__link">
        Open-source Projects
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://projects.eclipse.org/projects/modeling.epsilon/who" class="md-nav__link">
        Who is developing Epsilon?
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://ko-fi.com/eclipseepsilon" class="md-nav__link">
        How can I support Epsilon?
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.eclipse.org/forums/index.php/f/22/" class="md-nav__link">
        Forum
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../professional-services" class="md-nav__link">
        Professional Services
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_6" >
      
      
      
        <label class="md-nav__link" for="__nav_7_6" id="__nav_7_6_label" tabindex="0">
          Social Media
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_6_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7_6">
          <span class="md-nav__icon md-icon"></span>
          Social Media
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://twitter.com/eclipseepsilon" class="md-nav__link">
        Twitter
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://youtube.com/epsilondevs" class="md-nav__link">
        YouTube
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../labs/" class="md-nav__link">
        Epsilon Labs
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../faq/" class="md-nav__link">
        Frequently Asked Questions
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../../branding/" class="md-nav__link">
        Branding
      </a>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
    
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#worksheets-columns-and-rows" class="md-nav__link">
    Worksheets, Columns and Rows
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#references-and-column-types" class="md-nav__link">
    References and Column Types
  </a>
  
    <nav class="md-nav" aria-label="References and Column Types">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#worksheet" class="md-nav__link">
    Worksheet
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#column" class="md-nav__link">
    Column
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#reference" class="md-nav__link">
    Reference
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#querying-and-modifying-spreadsheets" class="md-nav__link">
    Querying and Modifying Spreadsheets
  </a>
  
    <nav class="md-nav" aria-label="Querying and Modifying Spreadsheets">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#creating-rows" class="md-nav__link">
    Creating Rows
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#deleting-rows" class="md-nav__link">
    Deleting Rows
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#modifying-cell-values" class="md-nav__link">
    Modifying Cell Values
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#validating-and-transforming-spreadsheets" class="md-nav__link">
    Validating and Transforming Spreadsheets
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#creating-spreadsheets" class="md-nav__link">
    Creating Spreadsheets
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#working-with-formulas" class="md-nav__link">
    Working with Formulas
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#reflective-access" class="md-nav__link">
    Reflective Access
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#resources" class="md-nav__link">
    Resources
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  

  
  


<h1 id="scripting-excel-spreadsheets-using-epsilon">Scripting Excel Spreadsheets using Epsilon<a class="headerlink" href="#scripting-excel-spreadsheets-using-epsilon" title="Permanent link">&para;</a></h1>
<p>Spreadsheets are commonly used in software and systems engineering processes to capture and analyse structured data, and can be sources of valuable information for model-based software engineering activities. </p>
<p>Epsilon provides built-in support for querying and transforming Excel spreadsheets through an <a href="https://poi.apache.org/">Apache POI</a>-based <a href="../../emc">EMC</a> driver. This article discusses how you can configure an Epsilon program to query and modify an Excel spreadsheet, and the video below demonstrates the driver in action.</p>
<iframe width="100%" height="494" src="https://www.youtube.com/embed/tTYGwgzxPMM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<details class="info">
<summary>Citing the Excel EMC driver in a publication?</summary>
<p>If you are referring to Epsilon's Excel EMC driver in a publication, please cite <a href="https://link.springer.com/chapter/10.1007/978-3-642-41533-3_3">this paper</a> instead of the website URL.</p>
</details>
<details class="bug">
<summary>Regression in Epsilon 2.2</summary>
<p>Due to a regression, the Excel driver is broken in Epsilon 2.2. The driver works well in previous versions (e.g. 2.1) as well as in 2.3. Support for column datatypes and for writing to Excel spreadsheets has improved substantially in 2.3.</p>
</details>
<h2 id="worksheets-columns-and-rows">Worksheets, Columns and Rows<a class="headerlink" href="#worksheets-columns-and-rows" title="Permanent link">&para;</a></h2>
<p>Essentially, in the Excel driver, by default, worksheets are treated as model element types (e.g. <code>Student</code>, <code>Staff</code>, <code>Module</code> and <code>Mark</code> in the spreadsheet below), columns as their properties (e.g. <code>Mark</code> has <code>student</code>, <code>module</code> and <code>mark</code> properties), and rows are treated as model elements (i.e. there are two students, two members of staff, three modules and two marks in the spreadsheet below).</p>
<style>
  .h {
    text-align: center;
    background-color: #EBEBEB;
  }
</style>

<div class="tabbed-set tabbed-alternate" data-tabs="1:4"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><input id="__tabbed_1_4" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Student</label><label for="__tabbed_1_2">Staff</label><label for="__tabbed_1_3">Module</label><label for="__tabbed_1_4">Mark</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<p><table>
  <tr><td class="h">&nbsp;</td><td class="h">A</td><td class="h">B</td><td class="h">C</td><td class="h">D</td><td class="h">E</td><td class="h">F</td></tr>
  <tr><td class="h">1</td><td>id</td><td>firstname</td><td>lastname</td><td>age</td><td>supervisor</td><td>modules</td></tr>
  <tr><td class="h">2</td><td>jt501</td><td>Joe</td><td>Thompson</td><td>23</td><td>mt506</td><td>MSD,RQE</td></tr>
  <tr><td class="h">3</td><td>js502</td><td>Jane</td><td>Smith</td><td>22</td><td>mt506</td><td>MSD,HCI</td></tr>
</table></p>
</div>
<div class="tabbed-block">
<p><table>
  <tr><td class="h">&nbsp;</td><td class="h">A</td><td class="h">B</td><td class="h">C</td><td class="h">D</td><td class="h">E</td><td class="h">F</td></tr>
  <tr><td class="h">1</td><td>id</td><td>firstname</td><td>lastname</td><td>teaches</td><td></td><td></td></tr>
  <tr><td class="h">2</td><td>mt506</td><td>Matthew</td><td>Thomas</td><td>MSD,RQE</td><td></td><td></td></tr>
  <tr><td class="h">3</td><td>dj503</td><td>Daniel</td><td>Jackson</td><td>HCI</td><td></td><td></td></tr>
</table></p>
</div>
<div class="tabbed-block">
<p><table>
  <tr><td class="h">&nbsp;</td><td class="h">A</td><td class="h">B</td><td class="h">C</td><td class="h">D</td><td class="h">E</td><td class="h">F</td></tr>
  <tr><td class="h">1</td><td>id</td><td>title</td><td>term</td><td></td><td></td><td></td></tr>
  <tr><td class="h">2</td><td>MSD</td><td>Modelling and System Design</td><td>Autumn</td><td></td><td></td><td></td></tr>
  <tr><td class="h">3</td><td>HCI</td><td>Human Computer Interaction</td><td>Spring</td><td></td><td></td><td></td></tr>
  <tr><td class="h">4</td><td>RQE</td><td>Requirements Engineering</td><td>Spring</td><td></td><td></td><td></td></tr>
</table></p>
</div>
<div class="tabbed-block">
<p><table>
  <tr><td class="h">&nbsp;</td><td class="h">A</td><td class="h">B</td><td class="h">C</td><td class="h">D</td><td class="h">E</td><td class="h">F</td></tr>
  <tr><td class="h">1</td><td>student</td><td>module</td><td>mark</td><td></td><td></td><td></td></tr>
  <tr><td class="h">2</td><td>jt501</td><td>MSD</td><td>62</td><td></td><td></td><td></td></tr>
  <tr><td class="h">3</td><td>js502</td><td>HCI</td><td>74</td><td></td><td></td><td></td></tr>
</table></p>
</div>
</div>
</div>
<h2 id="references-and-column-types">References and Column Types<a class="headerlink" href="#references-and-column-types" title="Permanent link">&para;</a></h2>
<p>The driver supports specifying additional configuration information (e.g. column data types, references between columns) about a spreadsheet in the form of an external XML document, that can be attached to the spreadsheet in Epsilon's run configuration dialog.</p>
<p>For our example spreadsheet, above, the configuration file below specifies the types of the <code>age</code> and <code>mark</code> columns of the spreadsheet, the multiplicity of the <code>teaches</code> column, as well as references between the <code>Student.supervisor</code> and <code>Staff.id</code>, and the <code>Staff.teaches</code> and <code>Module.id</code> columns.</p>
<div class="highlight"><pre><span></span><code><span class="nt">&lt;spreadsheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Student&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;age&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;modules&quot;</span><span class="w"> </span><span class="na">many=</span><span class="s">&quot;true&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Mark&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;mark&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Staff&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;teaches&quot;</span><span class="w"> </span><span class="na">many=</span><span class="s">&quot;true&quot;</span><span class="w"> </span><span class="na">delimiter=</span><span class="s">&quot;,&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Student-&gt;supervisor&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Staff-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Student-&gt;modules&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span><span class="w">           </span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Staff-&gt;teaches&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Mark-&gt;module&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Mark-&gt;student&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Student-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/spreadsheet&gt;</span>
</code></pre></div>
<p>The format of the XML configuration document is as follows:</p>
<h3 id="worksheet">Worksheet<a class="headerlink" href="#worksheet" title="Permanent link">&para;</a></h3>
<p>Each worksheet can have an optional name (if a name is not provided, the name of the worksheet on the spreadsheet is used) and acts as a container for <code>column</code> elements.</p>
<h3 id="column">Column<a class="headerlink" href="#column" title="Permanent link">&para;</a></h3>
<p>Each <code>column</code> needs to specify at least either its zero-based <code>index</code> in the context of the worksheet it belongs to, or its <code>name</code> (if a name is not provided, the cell value in the first row is used, as discussed above). Additionally, a <code>column</code> can have:</p>
<ul>
<li><code>alias</code>: an alternative name for the column.</li>
<li><code>datatype</code>: the type of the values in the column. As of Epsilon 2.5.0, the valid options (ignoring case) are <code>string</code>, <code>integer</code>, <code>boolean</code>, <code>double</code>, or <code>float</code>. The default datatype is <code>string</code>.</li>
<li><code>many</code>: it can be <code>true</code> or <code>false</code>. If <code>true</code>, then its cells will be considered to contain unbounded collections, separated by the <code>delimeter</code>(see below). Columns are single-valued by default.</li>
<li><code>delimeter</code>: the delimiter used to separate values if <code>many</code> is <code>true</code>. The default delimeter is <code>,</code>.</li>
</ul>
<p>As of 2.6.0, numeric values are converted to various datatypes as follows:</p>
<ul>
<li><code>string</code>: the textual representation of the cell's value is used, applying its declared format if possible. If the cell format is not supported, a format similar to the Excel General format will be used: <code>#</code> for whole numbers and <code>#.##########</code> for decimal numbers (see the Apache POI <a href="https://poi.apache.org/apidocs/4.1/org/apache/poi/ss/usermodel/DataFormatter.html">DateFormatter</a> documentation).</li>
<li><code>integer</code>, <code>double</code>, and <code>float</code>:  the cell value is computed (using the formula if one is present), and then cast to the appropriate datatype.</li>
<li><code>boolean</code>: zero values will be treated as <code>false</code>, and non-zero values will be treated as <code>true</code>.</li>
</ul>
<details class="bug">
<summary>Issues with numeric cell values in Epsilon 2.5.0 and earlier</summary>
<p>In Epsilon 2.5.0 and earlier releases, the Excel driver only supported the <code>integer</code>, <code>double</code>, and <code>float</code> datatypes for cells with numeric values. <code>string</code> and <code>boolean</code> datatypes were ignored, and treated as <code>double</code>. See <a href="https://github.com/eclipse/epsilon/issues/89">issue #89</a>.</p>
</details>
<h3 id="reference">Reference<a class="headerlink" href="#reference" title="Permanent link">&para;</a></h3>
<p>In a configuration document we can also specify ID-based references to capture relationships between columns belonging to potentially different worksheets. Each reference has a <code>source</code> and a <code>target</code> column, an optional <code>name</code> (if a name is not specified, the name of the source column is used to navigate the reference), a cardinality (<code>many</code> attribute), and specifies whether updates to cells of the target column should be propagated automatically (<code>cascadeUpdates</code> attribute) to the respective cells in the source column to preserve referential integrity.</p>
<h2 id="querying-and-modifying-spreadsheets">Querying and Modifying Spreadsheets<a class="headerlink" href="#querying-and-modifying-spreadsheets" title="Permanent link">&para;</a></h2>
<p>Having specified the configuration document above, we can now query the spreadsheet with EOL as follows.</p>
<pre class="prettyprint lang-eol"><code>// Returns all students supervised by Matthew Thomas
Student.all.select(s|s.supervisor?.lastname = "Thomas");

// Returns the modules taught by Daniel Jackson
Module.all.select(m|
    Staff.all.exists(s|
        s.firstname="Daniel" and s.teaches.includes(m)));</code></pre>
<h3 id="creating-rows">Creating Rows<a class="headerlink" href="#creating-rows" title="Permanent link">&para;</a></h3>
<p>As discussed above, worksheets are treated as types and rows as their instances. As such, to create a new row in the <code>Student</code> worksheet, EOL's <code>new</code> operation can be used.</p>
<pre class="prettyprint lang-eol"><code>var student : new Student;</code></pre>
<h3 id="deleting-rows">Deleting Rows<a class="headerlink" href="#deleting-rows" title="Permanent link">&para;</a></h3>
<p>To delete a row from a worksheet, EOL's <code>delete</code> operator can be used. When a row is deleted, all the rows that contain cells referring to it through cascade-update references also need to be recursively deleted.</p>
<pre class="prettyprint lang-eol"><code>var student = Student.all.selectOne(s|s.id = "js502");
// deletes row 2 of the Student worksheet
// also deletes row 3 of the Mark worksheet
delete student;</code></pre>
<h3 id="modifying-cell-values">Modifying Cell Values<a class="headerlink" href="#modifying-cell-values" title="Permanent link">&para;</a></h3>
<p>If a cell is single-valued, a type-conforming assignment can be used to edit its value. For example, the following listing demonstrates modifying the age and the supervisor of a particular student.</p>
<pre class="prettyprint lang-eol"><code>var student : Student = ...;
var supervisor : Staff = ...;
student.age = 24;
student.supervisor = supervisor;</code></pre>
<p>If on the other hand the cell is multi-valued, then its values should be handled as a collection. Adding/removing values from property collections has no effect on the spreadsheet; you need to re-assign values instead.</p>
<pre class="prettyprint lang-eol"><code>// Moves a module between two members of staff
var from : Staff = ...;
var to : Staff = ...;
var module : Module = ...;
// Neither of these will work
// from.teaches.remove(module);
// to.teaches.add(module);
// ... but these will
from.teaches = from.teaches.excluding(module);
to.teaches = to.teaches.including(module);</code></pre>
<p>Updating the value of a cell can have side effects to other cells that are linked to it through cascade-update references to preserve referential integrity. For example, updating the value of cell A3 in the <code>Module</code> worksheet, should trigger appropriate updates in cells D2 and F2 of the <code>Staff</code> and <code>Student</code> worksheets respectively.</p>
<h2 id="validating-and-transforming-spreadsheets">Validating and Transforming Spreadsheets<a class="headerlink" href="#validating-and-transforming-spreadsheets" title="Permanent link">&para;</a></h2>
<p>Of course, we can also validate spreadsheets using <a href="../../evl">EVL</a>, transform them into other models using <a href="../../etl">ETL</a>, and into text using <a href="../../egl">EGL</a>, generate graphical views using <a href="../../picto">Picto</a> etc.</p>
<pre class="prettyprint lang-evl"><code>context Staff {
    constraint NotOverloaded {
        check: self.teaches.size() &lt;= 4
        message: "Member of staff" + self.firstname +
          " " + self.lastname + " is overloaded"
    }
}</code></pre>
<h2 id="creating-spreadsheets">Creating Spreadsheets<a class="headerlink" href="#creating-spreadsheets" title="Permanent link">&para;</a></h2>
<p>To create a spreadsheet from scratch (e.g. when it is produced by an ETL transformation), we also need to specify an <code>index</code> for each column in the XML mapping file. Below is an EOL program that creates the <a href="#worksheets-columns-and-rows">spreadsheet above</a> from scratch, and the mapping file for it. The complete example is in <a href="https://github.com/eclipse/epsilon/tree/main/examples/org.eclipse.epsilon.examples.excel">Epsilon's Git repo</a>.</p>
<div class="tabbed-set tabbed-alternate" data-tabs="2:2"><input checked="checked" id="__tabbed_2_1" name="__tabbed_2" type="radio" /><input id="__tabbed_2_2" name="__tabbed_2" type="radio" /><div class="tabbed-labels"><label for="__tabbed_2_1">create-spreadsheet.eol</label><label for="__tabbed_2_2">mapping.xml</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<pre class="prettyprint lang-eol"><code>// Create the modules
var MSD = new Module(id="MSD", 
  title="Modelling and System Design", term="Autumn");

var HCI = new Module(id="HCI", 
  title="Human Computer Interaction", term="Spring");

var RQE = new Module(id="RQE", 
  title="Requirements Engineering", term="Spring");

// Create the staff  
var matthew = new Staff(id="mt506", firstname="Matthew",
  lastname="Thomas", teaches=Sequence{MSD, RQE});

var matthew = new Staff(id="dj503", firstname="Daniel",
  lastname="Jackson", teaches=Sequence{HCI});

// Create the students
var joe = new Student(id="jt501", firstname="Joe", 
  lastname="Thompson", age="23", supervisor=matthew, modules=Sequence{MSD, RQE});

var jane = new Student(id="js502", firstname="Jane", 
  lastname="Smith", age="22", supervisor=matthew, modules=Sequence{MSD, HCI});

// Create the marks
new Mark(student=joe, module=MSD, mark=62);
new Mark(student=jane, module=HCI, mark=74);</code></pre>
</div>
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code><span class="nt">&lt;spreadsheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Student&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;0&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;firstname&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;2&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;lastname&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;3&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;age&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;4&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;supervisor&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;5&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;modules&quot;</span><span class="w"> </span><span class="na">many=</span><span class="s">&quot;true&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Mark&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;0&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;student&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;module&quot;</span><span class="nt">/&gt;</span><span class="w">    </span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;2&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;mark&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Staff&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;0&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;firstname&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;2&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;lastname&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;3&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;teaches&quot;</span><span class="w"> </span><span class="na">many=</span><span class="s">&quot;true&quot;</span><span class="w"> </span><span class="na">delimiter=</span><span class="s">&quot;,&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Module&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;0&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;title&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;2&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;term&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Student-&gt;supervisor&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Staff-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Student-&gt;modules&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span><span class="w">           </span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Staff-&gt;teaches&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Mark-&gt;module&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Module-&gt;id&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;reference</span><span class="w"> </span><span class="na">source=</span><span class="s">&quot;Mark-&gt;student&quot;</span>
<span class="w">             </span><span class="na">target=</span><span class="s">&quot;Student-&gt;id&quot;</span><span class="nt">/&gt;</span><span class="w">                      </span>
<span class="nt">&lt;/spreadsheet&gt;</span>
</code></pre></div>
</div>
</div>
</div>
<h2 id="working-with-formulas">Working with Formulas<a class="headerlink" href="#working-with-formulas" title="Permanent link">&para;</a></h2>
<p>To set the value of a cell to a formula, start its value with <code>=</code> as shown below. The complete example is in <a href="https://github.com/eclipse/epsilon/tree/main/examples/org.eclipse.epsilon.examples.excel.formulas">Epsilon's Git repo</a>.</p>
<div class="tabbed-set tabbed-alternate" data-tabs="3:2"><input checked="checked" id="__tabbed_3_1" name="__tabbed_3" type="radio" /><input id="__tabbed_3_2" name="__tabbed_3" type="radio" /><div class="tabbed-labels"><label for="__tabbed_3_1">create-spreadsheet-with-formulas.eol</label><label for="__tabbed_3_2">mapping.xml</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<pre class="prettyprint lang-eol"><code>var calc : new Calc;
calc.a = 1;
calc.b = 2;
calc.sum = "=A2+B2";

calc.sum.println(); // Prints 3</code></pre>
</div>
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code><span class="nt">&lt;spreadsheet&gt;</span>
<span class="w">  </span><span class="nt">&lt;worksheet</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Calc&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;0&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;a&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;b&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;column</span><span class="w"> </span><span class="na">index=</span><span class="s">&quot;2&quot;</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;sum&quot;</span><span class="w"> </span><span class="na">datatype=</span><span class="s">&quot;integer&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/worksheet&gt;</span>
<span class="nt">&lt;/spreadsheet&gt;</span>
</code></pre></div>
</div>
</div>
</div>
<h2 id="reflective-access">Reflective Access<a class="headerlink" href="#reflective-access" title="Permanent link">&para;</a></h2>
<p>To iterate over all the worksheets, columns and rows of a speadsheet without referring to them by name, we can use the following statements (assuming that our Excel spreadsheet is named <code>M</code> in the run configuration). Additional methods of interest for this mode of access can be found in the Javadoc of the underlying <a href="https://download.eclipse.org/epsilon/interim-javadoc/org/eclipse/epsilon/emc/spreadsheets/excel/ExcelModel.html">ExcelModel</a> and <a href="https://download.eclipse.org/epsilon/interim-javadoc/org/eclipse/epsilon/emc/spreadsheets/SpreadsheetModel.html">SpreadsheetModel</a> classes.</p>
<pre class="prettyprint lang-eol"><code>// Iterate over all worksheets
for (w in M.worksheets) {
  w.name.println();

  // Iterate over all columns
  // of the worksheet
  for (c in w.header.columns) {
    c.name.println("\t");
  }

  // Iterate over all rows
  // of the worksheet
  for (r in w.rows) {
    r.println("\t");
  }
}</code></pre>
<h2 id="resources">Resources<a class="headerlink" href="#resources" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="../running-epsilon-ant-tasks-from-command-line#excel">This article</a> shows how to use Excel spreadsheets in ANT/Gradle/Maven builds.</li>
</ul>





                
              </article>
            </div>
          
          
  <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var tab,labels=set.querySelector(".tabbed-labels");for(tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script>

        </div>
        
      </main>
      
        <footer class="md-footer">
  
    
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
    <div class="md-copyright__highlight">
      Copyright © <a href="https://www.eclipse.org">Eclipse Foundation, Inc.</a> All Rights Reserved <br/> <a href="https://www.eclipse.org/legal/privacy.php">Privacy Policy</a> &centerdot; <a href="https://www.eclipse.org/legal/termsofuse.php">Terms of Use</a> &centerdot; <a href="https://www.eclipse.org/legal/copyright.php">Copyright Agent</a>  &centerdot; <a href="https://www.eclipse.org/legal/">Legal</a><p><img src="https://eclipse.dev/epsilon/assets/images/eclipse-foundation-logo.svg"/></p>
    </div>
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
        <div class="md-social">
  
    
    
    
    
      
      
    
    <a href="https://twitter.com/eclipseepsilon" target="_blank" rel="noopener" title="twitter.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
    </a>
  
    
    
    
    
      
      
    
    <a href="https://youtube.com/epsilondevs" target="_blank" rel="noopener" title="youtube.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"/></svg>
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": "../../..", "features": ["content.code.copy", "content.tabs.link", "navigation.footer"], "search": "../../../assets/javascripts/workers/search.74e28a9f.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
    
    
      <script src="../../../assets/javascripts/bundle.220ee61c.min.js"></script>
      
        
          <script src="https://unpkg.com/mermaid@8.5.1/dist/mermaid.min.js"></script>
        
      
        
          <script src="../../../assets/javascript/mermaid.js"></script>
        
      
        
          <script src="../../../assets/javascript/jquery.js"></script>
        
      
        
          <script src="../../../assets/javascript/slick.min.js"></script>
        
      
        
          <script src="../../../assets/javascript/google-code-prettify/prettify.js"></script>
        
      
        
          <script src="../../../assets/javascript/google-code-prettify/lang-emfatic.js"></script>
        
      
        
          <script src="../../../assets/javascript/google-code-prettify/lang-epsilon.js"></script>
        
      
        
          <script src="../../../assets/javascript/google-code-prettify/prettyprint.js"></script>
        
      
        
          <script src="../../../assets/javascript/extra.js"></script>
        
      
        
          <script src="https://w.appzi.io/w.js?token=jlv6W"></script>
        
      
    
  </body>
</html>